#include<stdio.h>
#define level 20
int fact(int n)
{
    int ans=1,i;
    for(i=2;i<=n;i++)ans*=i;
    return ans;
}
int cnr(int n,int r)
{
  //return fact(n)/fact(r)/fact(n-r);//method 1
  //method2;
  if(n==r||r==0)
    return 1;
  return cnr(n-1,r-1)+cnr(n-1,r);
}
int main()
{
   // freopen("yh.out","w",stdout);

    int i,j;
    for(i=0;i<level;i++)
    {
        for(j=0;j<=i;j++)
            printf("%6d ",cnr(i,j));
        puts("");
    }
    return 0;

}
